<template>
    <div>
<h2>显示</h2>
<table>
    <thead>
        <tr>
            <td>id</td>
            <td>name</td>
            <td>price</td>
            <td>num</td>
            <td>createDate</td>
            <td>操作</td>
        </tr>
    </thead>
    <tbody>
        <tr v-for="m in data">
            <td>{{ m.id }}</td>
            <td>{{ m.name }}</td>
            <td>{{ m.price }}</td>
            <td>{{ m.num }}</td>
            <td>{{ m.createDate }}</td>
            <td>操作</td>
        </tr>
    </tbody>
</table>
    </div>
</template>

<script setup lang="ts">
import { ref,onMounted } from 'vue';
import axios from 'axios';

onMounted(()=>{
    GetRoom();
})

const data=ref([{
  "id": 0,
  "name": "string",
  "price": 0,
  "num": 0,
  "createDate": "2025-03-17T02:25:12.823Z"
}])

const page=ref({
    index:1,
    size:2,
    name:"",
    id:0
})

const pagecount=ref({
    count:0,
    pcount:0
})

const GetRoom=()=>{
    axios.get("https://localhost:7227/api/Room/GetRoom",{params:page.value}).then(res=>{
        data.value=res.data.data;
        pagecount.value.count=res.data.count;
        pagecount.value.pcount=Math.ceil(res.data.count/page.value.size);
    })
}
</script>

<style scoped>

</style>